package com.csxy.lxl.controller;

import com.csxy.lxl.R;
import com.csxy.lxl.entity.EduCourse;
import com.csxy.lxl.entity.EduTeacher;
import com.csxy.lxl.service.EduCourseService;
import com.csxy.lxl.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/eduservice/indexFront")
public class IndexFrontController {
    @Autowired
    private EduCourseService eduCourseService;
    @Autowired
    private EduTeacherService eduTeacherService;

    //查询前8条热门课程，查询前4条热门名师

    @GetMapping("/index")
    public R index() {
        List<EduCourse> courseList = eduCourseService.selectHotCourse();
        List<EduTeacher> teacherList = eduTeacherService.selectHotTeachers();
        return R.ok().data("courseList", courseList).data("teacherList", teacherList);
    }
}
